using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class ResMgr : MonoBehaviour
{
    public static ResMgr Instance = null;

    private void Awake()
    {
        Instance = this;
    }

    public IEnumerator LoadAB(string name, Action<UnityEngine.Object> action)
    {
        UnityWebRequest uwa = UnityWebRequestAssetBundle.GetAssetBundle("file://" + Application.streamingAssetsPath + "/" + name + ".t");
        yield return uwa.SendWebRequest();
        AssetBundle ab = DownloadHandlerAssetBundle.GetContent(uwa);
        UnityEngine.Object uobj = ab.LoadAsset(name);
        action(uobj);
        ab.Unload(false);
    }
}